package swind.web.dao.imp;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import swind.web.dao.ITestDao;
import swind.web.dao.base.BaseHibernateDAO;
import swind.web.entities.ExamTest;
import swind.web.vo.TestVo;

@Repository("testDaoImp")
public class TestDaoImp extends BaseHibernateDAO<ExamTest> implements ITestDao {

	@Override
	@SuppressWarnings({ "unchecked" })
	public List<ExamTest> getTotalTestMapBySubject(Integer subId,Integer testType) {
		String hql = "from ExamTest et where et.subject.id = "+subId+" and et.testType.id = "+testType;
		return this.createQuery(hql).list();
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<ExamTest> getTestByIdList(List<Integer> resultTestIdList) {
		if(resultTestIdList==null||resultTestIdList.isEmpty()){
			System.out.println("test id list is null or empty");
			return null;
		}
		String hql = "from ExamTest et where et.id in (:idList)";
		return this.createQuery(hql).setParameterList("idList", resultTestIdList).list();
	}

	

}
